package com.shujing.mapper;

import com.shujing.pojo.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 陈书憬
 * @version 1.0
 * 2024/4/9
 */
@Mapper
public interface ArticleMapper {

    @Insert("insert into article (title, content, cover_img, category_id, create_user, create_time, update_time, state) " +
            "values (#{title},#{content},#{coverImg},#{categoryId},#{createUser},#{createTime},#{updateTime},#{state}) ")
    void insert(Article article);

    List<Article> list(Integer userId, Integer categoryId, String state);

    @Select("select * from article where id = #{id}")
    Article selectById(Integer id);

    void update(Article article);

    @Delete("delete from article where id = #{id}")
    void delete(Integer id);
}
